package com.be.beadmin.project.entity;

import com.be.beadmin.common.entity.BaseEntity;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @Author Jiahao Liu
 * @CreateTime 2023-01-13
 * @Description 批次计划
 */
@Entity
@Table(name = "T_PM_BatchPlan")
@Getter
@Setter
public class BatchPlan extends BaseEntity {

    @Column(name = "SerialNo", columnDefinition = "VARCHAR(50) COMMENT '流水号' ")
    private String serialNo;

    @Column(name = "InfoId",columnDefinition = "VARCHAR(50) COMMENT '项目id'")
    private String infoId;

    @Column(name = "projectName",columnDefinition = "VARCHAR(50) COMMENT '项目名称' ")
    private String projectName;

//    @Column(name = "projectCode",columnDefinition = "VARCHAR(50) COMMENT '项目编码' ")
//    private String projectCode;

    @Column(name = "MasterPlanId",columnDefinition = "VARCHAR(50) COMMENT '主计划id' not null")
    private String masterPlanId;

    /**
     * 柜体
     */
    @Column(name = "CabinetCount",columnDefinition = "int COMMENT 'C' ")
    private Integer cabinetCount;
    /**
     * 操作台
     */
    @Column(name = "OperationCount",columnDefinition = "int COMMENT 'P' ")
    private Integer operationCount;
    /**
     * 箱体
     */
    @Column(name = "BoxCount",columnDefinition = "int COMMENT 'B' ")
    private Integer boxCount;
    /**
     * 其他
     */
    @Column(name = "OthersCount",columnDefinition = "int COMMENT 'OTHERS'")
    private Integer othersCount;

    /**
     * 0 未下发
     * 1 设计中
     * 2 生产中
     * 。。。
     * -1 暂停
     */
    @Column(
            name = "State",
            nullable = false,
            columnDefinition = "decimal(1) default 0 COMMENT '批次计划状态' "
    )
    protected Integer state = 0;

    @Column(name = "CurrentBatch",columnDefinition = "int COMMENT '当前批次' not null")
    private Integer currentBatch;

    @Column(name = "BatchCount",columnDefinition = "int COMMENT '批次总数' not null")
    private Integer batchCount;

    @Column(name = "BatchPlanCode", columnDefinition = "VARCHAR(50) COMMENT '计划编码' ")
    private String batchPlanCode;

    @Column(name = "BatchDeliveryDate", columnDefinition = "datetime COMMENT '批次交货日期' ")
    private Date batchDeliveryDate;
    @Column(name = "InfoDeliveryDate", columnDefinition = "datetime COMMENT '项目交货日期' ")
    private Date infoDeliveryDate;

    @Column(name = "Memo", columnDefinition = "VARCHAR(50) COMMENT '备注' ")
    private String memo;

    @Column(name = "Reserved", columnDefinition = "VARCHAR(50) COMMENT '预留' ")
    private String reserved;

    @Column(name = "WorkHour",columnDefinition = "float COMMENT '实际工时'")
    private Float workHour;

    @Column(name = "RealWorkHour",columnDefinition = "float COMMENT '实际工时'")
    private Float realWorkHour;

    @Column(name = "IsSchduling",columnDefinition = "tinyint COMMENT '正在排程吗' default 0")
    private int isSchduling;

    @Column(name = "NumPercent",columnDefinition = "decimal(5,4) default 0 COMMENT '数量齐套率'")
    private BigDecimal numPercent = BigDecimal.ZERO;

    @Column(name = "TypePercent",columnDefinition = "decimal(5,4) default 0 COMMENT '种类齐套率'")
    private BigDecimal typePercent = BigDecimal.ZERO;

    @Override
    public String toString() {
        return "BatchPlan{" +
                "serialNo='" + serialNo + '\'' +
                ", infoId='" + infoId + '\'' +
                ", projectName='" + projectName + '\'' +
                ", masterPlanId='" + masterPlanId + '\'' +
                ", currentBatch=" + currentBatch +
                ", batchCount=" + batchCount +
                ", batchPlanCode='" + batchPlanCode + '\'' +
                ", batchDeliveryDate=" + batchDeliveryDate +
                ", memo='" + memo + '\'' +
                ", reserved='" + reserved + '\'' +
                '}';
    }
}